#include<bits/stdc++.h>
using namespace std;
int t,n,a[1000005],ans,x,maxx;
int main(){
	freopen("color.in","r",stdin);
	freopen("color.out","w",stdout);
	scanf("%d",&t);
	while(t--){
		ans=maxx=0;
		memset(a,0,sizeof a);
		scanf("%d",&n);
		for(int i=1;i<=n;i++){cin>>x;a[x]++;maxx=max(maxx,x);}
		for(int i=1;i<=maxx;i++) ans+=a[i]/2*i;
		printf("%d",ans);
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
